﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SkuOrderView.aspx.cs" Inherits="ZLCMS.Web.SystemManage.Basics.SkuOrderView" %>

<%@ Import Namespace ="ZLCMS.Business.Util" %>
<%@ Import Namespace ="ZLCMS.Data.Model" %>
<%@ Import Namespace ="ZLCMS.Business.Shop" %>
<%@ Register src="~/SystemManage/Control/JGridControl.ascx" tagname="JGridControl" tagprefix="uc1" %>
<form id="pageForm" method="post" runat="Server" class="pageForm required-validate"
    onsubmit="return validateCallback(this, navTabAjaxDone);" action="/SystemManage/Basics/SkuOrderInfo/SkuOrderView.aspx">

<!-- 需保存的全局变量，提交时URL参数会丢失 -->
<asp:label runat="server" ID="_id" Visible="False" ></asp:label>
<asp:label runat="server" ID="_freshtabid" Visible="False" >刷新列表TAB</asp:label>
    
<div class="pageContent">
    <div class="pageFormContent" layoutH="56">
    
    
	<div class="panel collapse">
		<h1>修改订单状态和选择发货执行方 </h1>
		<div>
    	<table class="list" width="100%">
    	<tr>
			<td style="width:20%">修改订单状态为：</td>
			<td style="width:70%">
            <table border="0" cellspacing="0" cellpadding="0">
            	<tr>
            		<td>
                    <%-- 确认订单--%>
                    <%if (_ordersDB.IsConfirmed == "1" || _ordersDB.IsCancelled == "1"){%>
                      [<%= ParamKit.GetValue("OrderIsConfirmed", _ordersDB.IsConfirmed, "&nbsp;")%>]
                   <%}else{ %>
                     <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/SkuOrderInfo/SkuOrderConfirmed.aspx?uid=<%= _ordersDB.OrderNo  %>" target="dialog" rel="ordersendgoods" max="false" mask="true" maxable="false" minable="false" width="800" height="400" title="请确认订单"><span>确认订单</span></a>
                     <%} %>
                </td>
                    <td>
                      <%-- 确认支付--%>
                         <%if (_ordersDB.PayStatus == "1" || _ordersDB.IsCancelled == "1" ){%>
                            [<%= ParamKit.GetValue("OrderPayStatus", _ordersDB.PayStatus, "&nbsp;")%>]
                         <%}else if (_ordersDB.IsConfirmed == "1"){ %>
                            <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/SkuOrderInfo/SkuOrderPayed.aspx?uid=<%= _ordersDB.OrderNo  %>" target="dialog" rel="ordersendgoods" max="false" mask="true" maxable="false" minable="false" width="800" height="400" title="请确认支付"><span>确认支付</span></a>
                          <%} else{ %>
                            [<%= ParamKit.GetValue("OrderPayStatus", _ordersDB.PayStatus, "&nbsp;")%>]
                         <%} %>
                    </td>
                    <td>
                   <%-- 确认发货--%>
                         <%if (_ordersDB.ShippingStatus == "1" || _ordersDB.ShippingStatus == "-9"){%>
                              [<%= ParamKit.GetValue("OrderShippingStatus", _ordersDB.ShippingStatus, "&nbsp;")%>]
                         <%}else if (_ordersDB.IsConfirmed == "1"&&(_ordersDB.PayStatus == "1" || _paymentDB.InterfaceId == "NOPAY")){ %>
                              <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/SkuOrderInfo/SkuOrderSended.aspx?uid=<%= _ordersDB.OrderNo  %>" target="dialog" rel="ordersendgoods" max="false" mask="true" maxable="false" minable="false" width="800" height="400" title="请确认发货"><span>确认发货</span></a>
                         <%} else{ %>
                            [<%= ParamKit.GetValue("OrderShippingStatus", _ordersDB.ShippingStatus, "&nbsp;")%>]
                         <%} %>

                    </td>
                    <td>
                    <%-- 确认完成--%>
                         <%if (_ordersDB.IsFinished == "1"|| _ordersDB.IsCancelled == "1"){%>
                         [<%= ParamKit.GetValue("OrderIsFinish", _ordersDB.IsFinished, "&nbsp;")%>]
                         <%}else{ %>
                         <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/SkuOrderInfo/SkuOrderFinished.aspx?uid=<%= _ordersDB.OrderNo  %>" target="dialog" rel="ordersendgoods" max="false" mask="true" maxable="false" minable="false" width="800" height="400" title="请确认完成订单"><span>完成订单</span></a>
                         <%} %>
                    </td>
                    <td>
                    <%-- 确认取消--%>
                       <%if (_ordersDB.IsCancelled == "1"&&(_ordersDB.IsFinished != "1" || _ordersDB.PayStatus != "1" || _ordersDB.ShippingStatus != "1"))
                         {%>
                       <a class="button" href="/SystemManage/Basics/SkuOrderInfo/SkuOrderCancel.aspx?uid=<%= _ordersDB.OrderNo  %>" target="dialog" rel="ordersendgoods" max="false" mask="true" maxable="false" minable="false" width="800" height="400" title="请确认取消订单"><span>取消订单</span></a>
		            	<%}else{ %>
                          [<%= ParamKit.GetValue("OrderIsCancel", _ordersDB.IsCancelled, "&nbsp;")%>]
		            	<%} %>
                    </td>
                </tr>
           </table>
            </td>
        </tr>
    	<tr>
			<td>附言：</td>
			<td>
				<asp:TextBox ID="tb_glyfy" runat="server" TextMode="MultiLine" rows="5" 
                    Width="500px" ></asp:TextBox>
			</td>
				<td colspan="4"><a class="button" href="/SystemManage/Basics/SkuOrderInfo/EditSkuOrderAddress.aspx?uid=<%= _ordersDB.OrderNo  %>" target="dialog" rel="editorderaddress" max="false" mask="true" maxable="false" minable="false" width="800" height="400" title="修改地址"><span>修改地址</span></a></td>
        </tr>
        </table>
		</div>
	</div>
    <div class="panel collapse">
		<h1>发货单信息</h1>
		<div>
		
    	<table class="list" width="100%">
    	<tr>
			<td style="width: 70%"> <uc1:JGridControl ID="JGridControl2" runat="server" DialogHeight="380" DialogWidth="750"
                         KeyColumnName="ShippingNo" />
        </td>
        </tr>
        </table>
              <%
          if (JGridControl2.Readonly == false)
          { %>
        <div style="float:right">
			<div class="buttonActive"><div class="buttonContent"><button type="submit">保存发货单</button></div></div>
        </div>
        <%} %>
		</div>
	</div>
	<div class="panel collapse">
		<h1>订单信息</h1>
		<div>
		
    	<table class="list" width="100%">
        <tr>
        <td style="width: 10%;">订单编号：</td>
        <td colspan='3'><%=_ordersDB.OrderNo%></td>
        </tr>
    	<tr>
			<td style="width: 10%;">订单状态：</td>
			<td style="width: 40%">
				    [<%= ParamKit.GetValue("OrderIsConfirmed", _ordersDB.IsConfirmed, "&nbsp;")%>]
				    <font color="<%=_ordersDB.PayStatus=="1"?"'Lime'":"'Red'" %>">[<%= ParamKit.GetValue("OrderPayStatus", _ordersDB.PayStatus, "&nbsp;")%>]</font>
				    [<%= ParamKit.GetValue("OrderShippingStatus", _ordersDB.ShippingStatus, "&nbsp;")%>]
				    [<%= ParamKit.GetValue("OrderIsFinish", _ordersDB.IsFinished, "&nbsp;")%>]
				    [<%= ParamKit.GetValue("OrderIsCancel", _ordersDB.IsCancelled, "&nbsp;")%>]
			</td>
		<%--	<td style="width: 10%">配送方式：</td>
			<td style="width: 40%">
            
            <span style="line-height:25px;float:left;margin-right:15px"><%= _shippingDB == null ? "数据错误!" : _shippingDB.ShippingName%></span>
            <%if (_shippingDB != null && !string.IsNullOrEmpty(_ordersDB.ShippingNo))
              { %>
              <a class="button" href="<%=Kuaidi100Util.GetQueryUrl(_shippingDB.Id,_ordersDB.ShippingNo)%>"  target="_blank" rel="showshippinginfo" max="false" mask="true" maxable="false" minable="false" width="800" height="600" title="跟踪订单"><span>跟踪订单</span></a>
            <%} %>
            </td>--%>
        </tr>
    	<tr>
			<td>支付方式：</td>
			<td><%= _paymentDB == null ? "数据错误!" : _paymentDB.PaymentName%></td>
			<td>发票信息：</td>
			<td><%= _ordersDB.InvoiceInfo%></td>
        </tr>
        </table>
        
        <div class="divider"></div>
        
        <table class="list" width="100%" targetType="navTab" asc="asc" desc="desc">
	    <thead>
			<tr>
				<th width="5%" style="display: none">编号</th>
				<th>商品代码</th>
				<th>SKU代码</th>
				<th>SKU群组</th>
				<th>商品名称</th>
				<th>数量</th>
				<th>商品价格</th>
				<th>单项小计</th>
				<th>是否参与打折</th>
				<th width="5%">操作</th>
			</tr>
		</thead>
		<tbody>
            <asp:repeater runat="server" id="grid">
                <ItemTemplate>
			    <tr target="uid" rel='<%# NHibernateKit.GetItem<ShopOrderProduct>(Container.DataItem, 0).Id %>'>
				    <td style="display: none"><span><%# NHibernateKit.GetItem<ShopOrderProduct>(Container.DataItem, 0).Id%></td>
				    <td><%# NHibernateKit.GetItem<ShopProductInfo>(Container.DataItem, 1).ProductNo%></td>

				    <td><%# NHibernateKit.GetItem<ShopSkuProduct>(Container.DataItem, 2).ProductSkuCode%></td>
				    <td><%# ShowSkuItem(  NHibernateKit.GetItem<ShopSkuProduct>(Container.DataItem, 2).ParamCode )%></td>

				    <td><%# NHibernateKit.GetItem<ShopProductInfo>(Container.DataItem, 1).ProductName%></td>
				    <td><%# NHibernateKit.GetItem<ShopOrderProduct>(Container.DataItem, 0).Quantity%></td>
				    <td><%# NHibernateKit.GetItem<ShopOrderProduct>(Container.DataItem, 0).UnitPrice.ToString()%></td>
				    <td><%# NHibernateKit.GetItem<ShopOrderProduct>(Container.DataItem, 0).TotalPrice.ToString()%></td>
				    <td><%# ParamKit.GetValue("YesNo_10", NHibernateKit.GetItem<ShopOrderProduct>(Container.DataItem, 0).IsDiscount, "&nbsp;")%></td>
				    <td> 
				        <a href="/Wap/Shop/ProductDetail.aspx?no=<%# NHibernateKit.GetItem<ShopProductInfo>(Container.DataItem, 1).ProductNo%>" target="_blank">查看</a>&nbsp;&nbsp;
<%--				        <a href="#" target="ajaxTodo" title="请确定要删除" warn="请选择一项">删除</a>--%>
				    </td>
			    </tr>
                </ItemTemplate>
            </asp:repeater>
		</tbody>
	</table>
	
        <div class="divider"></div>
    	
    	<table class="list" width="100%">
    	<tr>
			<td style="width: 10%">商品总金额：</td>
			<td style="width: 20%"><%= _ordersDB.ProductPrice.ToString()%></td>
			<td style="width: 10%">配件价格：</td>
			<td style="width: 20%"><%= _ordersDB.ItemsPrice.ToString()%></td>
			<td style="width: 10%">商品运费：</td>
			<td style="width: 20%"><%= _ordersDB.ShipPrice.ToString()%></td>
        </tr>
    	<tr>
			<td>订单总金额：</td>
			<td><%= _ordersDB.TotalPrice.ToString()%></td>
            <%
                if (AuthorizationKit.GetInstance().GetAuthorizationValue("ORDER", "EDIT_PRICE") > 0 ) 
                { %>
			<td colspan="4">
			<asp:TextBox ID="tb_totalprice" runat="server"></asp:TextBox>&nbsp;
			<div class="button"><div class="buttonContent"><button type="submit">修改订单总金额</button></div></div>
			</td>
            <%} %>
        </tr>
    	<%--<tr>
			<td>使用预付款金额：</td>
			<td><%= _ordersDB.UseAdvancePayment.ToString()%></td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>还需付款金额：</td>
			<td style="color:Red"><%= _hxffje.ToString() %></td>
        </tr>--%>
        </table>
		</div>
	</div>
    <%if (rpt_couponlist.Items.Count > 0)
      { %>
    	<div class="panel collapse">
		<h1>优惠记录</h1>
		<div>
		
    	<table class="list" width="100%">
          <thead>
			<tr>
				<th width="5%" style="display: none">编号</th>
				<th>优惠券名</th>
				<th>优惠金额</th>
				<th width="5%">操作</th>
			</tr>
		</thead>
         <asp:repeater runat="server" id="rpt_couponlist">
                <ItemTemplate>
    	<tr target="uid" rel='<%# Eval("Id") %>'>
			 <td style="display: none"><span><%#  Eval("Id") %></td>
				    <td><%#  Eval("Title") %></td>
				    <td><%#  Eval("Price") %></td>
        </tr>
         </ItemTemplate>
            </asp:repeater>
        </table>
		</div>
	</div>
    <%} %>
	<div class="panel collapse">
		<h1>购货人信息</h1>
		<div>
		
    	<table class="list" width="100%">
    	<tr>
			<td style="width: 8%">购货人姓名：</td>
			<td style="width: 25%"><%= _ordersMemberDB.MemberName%></td>
			<td style="width: 8%">用户名：</td>
			<td style="width: 25%"><%= _ordersMemberDB.AccountId%></td>
			<td style="width: 8%">联系电话：</td>
			<td style="width: 25%"><%= _ordersMemberDB.Telephone%></td>
        </tr>
    	<tr>
			<td>Email地址：</td>
			<td><%= _ordersMemberDB.Email%></td>
			<td>购货人地址：</td>
			<td><%= _ordersMemberDB.Address%></td>
			<td>邮政编码：</td>
			<td><%= _ordersMemberDB.PostalCode %></td>
        </tr>
        </table>
		</div>
	</div>
    
	<div class="panel collapse">
		<h1>收货人信息</h1>
		<div>
    	<table class="list" width="100%">
    	<tr>
			<td style="width: 8%">收货人姓名：</td>
			<td style="width: 25%"><%= _ordersDB.ReceiverName %></td>
			<td style="width: 8%">联系电话：</td>
			<td style="width: 25%"><%= _ordersDB.ReceiverPhone %></td>
			<td style="width: 8%">Email地址：</td>
			<td style="width: 25%"><%= _ordersDB.ReceiverEmail %></td>
        </tr>
    	<tr>
			<td>收货人地址：</td>
			<td><%= _ordersDB.ReceiverAddress %></td>
			<td>邮政编码：</td>
			<td><%= _ordersDB.ReceiverPostalCode %></td>
			<td>备注：</td>
			<td><%= _ordersDB.Remark %></td>
        </tr>
        </table>
		</div>
	</div>
    	
	<div class="panel collapse">
		<h1>订单操作记录</h1>
		<div>
		<%= _ordersDB.ManageHistory %>
		</div>
	</div>
    	
	</div>
        
	<div class="formBar">
		<ul>
			<li><div class="button"><div class="buttonContent"><button type="button" class="close">关闭</button></div></div></li>
		</ul>
	</div>  
</div>

</form>